package com.mk.common.util;

public final class StringUtils
{
	/**
	 * 判断空串
	 * @param str
	 * @return
	 */
	public static boolean isEmpty(String str) {
		if(str==null)
			return true;
		if( "".equals(str.trim()) )
			return true;
		return false;
	}
	
	/**
	 * 获取指定长度的字符串，"0"填充
	 * @param str
	 * @param length
	 */
	public static String getStandLengthString(String str, int length) {
		if(isEmpty(str) || length<=0)
			return "";
		int size = str.length(); //字符串长度
		if(size>=length)
			return str;
		
		int subLength = length-size;
		StringBuffer temp = new StringBuffer("");
		for(int i=0; i<subLength; i++) {
			temp.append("0");
		}
		
		return temp.append(str).toString();
	}
	
	
}
